#include <iostream>
#include <queue>
using namespace std;

struct customer {
    int id;
    int time;
};

struct compare {
    bool operator()(customer a, customer b) {
        return a.time > b.time;
    }
};

int main() {
    priority_queue<customer, std::vector<customer>, compare> customers;
    int customerCnt; cin >> customerCnt;
    for (int i = 1; i <= customerCnt; i++) {
        int orderTime, workTime; cin >> orderTime >> workTime;
        customer curr {i, orderTime + workTime};
        customers.push(curr);
    }
    while (!customers.empty()) {
        int currNum = customers.top().id;
        cout << currNum << ((customers.size() > 1) ? " " : "");
        customers.pop();
    }
    return 0;
}